import React, { Component } from 'react'
import { Select } from 'antd'

const { Option } = Select

export default class MySelect extends Component {
    render() {
        const { list, defaultValue, change } = this.props
        return (
            <Select defaultValue = { defaultValue } style={{ width: 120 }} onChange={ (value) => {
                change(value)
            } }>
                {
                    list.map(item => {
                        let items = item.exam_id || item.subject_id || item.questions_type_id
                        let item_name = item.exam_name || item.subject_text || item.questions_type_text
                        return <Option key = { items } value = { items }>
                            { item_name }
                        </Option>
                    })
                }
            </Select>
        )
    }
}
